package iwpl.project.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Accounts entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Accounts", uniqueConstraints = @UniqueConstraint(columnNames = "UserName"))
public class Accounts implements java.io.Serializable {

	// Fields

	private Integer id;
	private Roles roles;
	private Employees employees;
	private String userName;
	private String password;
	private Boolean active;

	// Constructors

	/** default constructor */
	public Accounts() {
	}

	/** minimal constructor */
	public Accounts(Integer id) {
		this.id = id;
	}

	/** full constructor */
	public Accounts(Integer id, Roles roles, Employees employees,
			String userName, String password, Boolean active) {
		this.id = id;
		this.roles = roles;
		this.employees = employees;
		this.userName = userName;
		this.password = password;
		this.active = active;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RoleID")
	public Roles getRoles() {
		return this.roles;
	}

	public void setRoles(Roles roles) {
		this.roles = roles;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "EmployeeID")
	public Employees getEmployees() {
		return this.employees;
	}

	public void setEmployees(Employees employees) {
		this.employees = employees;
	}

	@Column(name = "UserName", unique = true)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "Password")
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "Active")
	public Boolean getActive() {
		return this.active;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

}